import 'package:mall/modules/model/address_entity.dart';
import 'package:mall/modules/service/cart_service.dart';

import '../../utils/sc/state_controller.dart';
import '../model/fill_in_order_entity.dart';

class FillInOrderSc extends ModelSC<FillInOrderEntity> {
  int? cardId;


  @override
  Future<FillInOrderEntity?> loadData() async{
    if (cardId == null){
      throw ArgumentError('cardId 不能为空');
    }
    final res = await CartService.cartCheckOut(cardId!);
    return res;
  }

  void updateAddress(AddressList checkedAddress) {
    data.update((value){
      value?.checkedAddress = checkedAddress;
    });
  }
}